package com.imti.clientapp;

import android.content.ContentValues;
import android.net.Uri;
import android.util.Log;
import androidx.appcompat.app.AppCompatActivity;
import android.os.Bundle;

public class MainActivity extends AppCompatActivity
{

    private static final String TAG = MainActivity.class.getSimpleName();

    private static final String AUTHORTIES = "com.imti.provider.test";

    /**
     * 添加学生信息
     */
    private static final Uri ADD_STUDENT = Uri.parse("content://" + AUTHORTIES + "/addStu");

    @Override
    protected void onCreate(Bundle savedInstanceState)
    {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        initData();
    }

    private void initData()
    {
        ContentValues cv = new ContentValues();
        cv.put("stu_name", "李四");
        cv.put("stu_class", "大数据");
        cv.put("stu_company", "Tencent");

        Uri resultUri = getContentResolver().insert(ADD_STUDENT, cv);

        Log.d(TAG, "外部插入数据结果：" + resultUri.toString());
    }
}